
$(function(){
	
	$('body').on('click',".addDriverLdapLebelClick",function(){
		console.log(this);
		console.log($(this).attr("attr"));
	});
	
});

//点击ldap详细信息新增域名，对象和属性等
function addLdapDetail(type,page){
	switch(type){
		case 'addBase':
			var baseHtml=$(
					'<div class="form-group">'
					+'<label class="col-sm-2 control-label">域名<strong>*</strong></label>'
					+'<div class="col-sm-9">'
					+'<input class="form-control" name="baseContexs" type="text" value="" placeholder="如dc=com" />'			
					+'</div>'			
					+'<label class="fa fa-minus col-sm-1 form-control-static"></label>'
					+'</div>');	
		$(page).parents(".ObjectContent").append(baseHtml);
		break;
		case 'addUser':
			var userHtml=$(
					'<div class="form-group">'
					+'<label class="col-sm-2 control-label">对象<strong>*</strong></label>'
					+'<div class="col-sm-9">'
					+'<input class="form-control" name="baseContexs" type="text" value="" placeholder="如 inetOrgPerson" />'			
					+'</div>'			
					+'<label class="fa fa-minus col-sm-1 form-control-static"></label>'
					+'</div>');	
			$(page).parents(".ObjectContent").append(userHtml);
		break;
		case 'addProperty':
			var propertyHtml=$(
					'<div class="form-group">'
					+'<label class="col-sm-3 control-label">属性<strong>*</strong></label>'
					+'<div class="col-sm-8">'
					+'<input class="form-control" name="baseContexs" type="text" value="" placeholder="如 userId" />'			
					+'</div>'			
					+'<label class="fa fa-minus col-sm-1 form-control-static"></label>'
					+'</div>');	
			$(page).parents(".ObjectContent").append(propertyHtml);
			break;
		default:
			break;
	}
}
//ldap切换和动态加载数据
function changeLdapInfo(fa){
	//点击ldap详细信息删除域名，对象和属性等
	fa.parents('.form-group').next().on("click",".fa-minus",function(){
		$(this).parent('.form-group').remove();
	});
	//Ldap详细信息切换事件
	fa.parents('.form-group').next().on("click",".fa",function(){
		if($(this).hasClass('fa-caret-down')){
			$(this).parents('.ObjectTitle').next().slideUp();
			$(this).attr('class',"fa fa-caret-right fa-x");
		}else if($(this).hasClass('fa-caret-right')){
			$(this).parents('.ObjectTitle').next().slideDown();
			$(this).attr('class',"fa fa-caret-down fa-x");
		}
	});
}
